package com.ctrip.ec.api.admin.controller.goods;
import com.ctrip.ec.api.admin.model.query.QueryModel;
import com.ctrip.ec.dal.PagerSetting;
import com.ctrip.ec.api.admin.common.RequestContext;
import com.ctrip.ec.biz.dao.goods.GoodsSpecDao;
import com.ctrip.ec.biz.entity.goods.GoodsSpecEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
@RestController
@RequestMapping("/goodsSpec")
public class GoodsSpecController{
    @Autowired
    private GoodsSpecDao goodsSpec;
    @GetMapping("list")
    public List<GoodsSpecEntity> list() throws SQLException {
        List<GoodsSpecEntity> list = goodsSpec.list();
        return list;
    }
    @GetMapping("detail/{id}")
    public  GoodsSpecEntity detail(@PathVariable Long id) throws SQLException {
        return goodsSpec.entity(id);
    }
    @PostMapping("save")
    public  Long save(@RequestBody GoodsSpecEntity entity) throws SQLException {
        goodsSpec.save(entity);
        return entity.getId();
    }
    @PostMapping("delete")
    public  void delete(@RequestBody List<Long> ids) throws SQLException {
        goodsSpec.delete(ids);
    }
}
